/*
 * Copyright (C) RT, 2017 by kiterunner_t
 * TO THE HAPPY FEW
 */

package com.zgys.mes.util.error;

import lombok.Data;

@Data
public class RtException extends RuntimeException {

    private int code;
    private String message;
    private Object content;


    public RtException(RtErrorEnum exceptionType) {
        this.code = exceptionType.getCode();
        this.message = exceptionType.getMessage();
    }
    public RtException(RtResponse response) {
        this.code = response.getCode();
        this.message = response.getMessage();
        this.content = response.getContent();
    }

    public RtException(RtErrorEnum errorType, String msg) {
        this.code = errorType.getCode();
        this.message = msg;
    }
    public int getCode() {
        return this.code;
    }


    @Override
    public String getMessage() {
        return this.message;
    }


    @Override
    public String toString() {
        return "AuroraException{ code=" + code + ", message=" + message + "}";
    }
}

